<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a="http://richfaces.org/a4j"
    template="layout/template.xhtml">

<ui:define name="body">

<a:loadScript src="js/sw-util.js" />
<a:loadScript src="js/jquery.maskedinput-1.3.js" />
<a:loadScript src="js/jquery.maskedinput-1.1.4.pack.js" />

<h:messages globalOnly="true" styleClass="message"/>


    <h:form id="PesquisaClienteForm">

        <rich:panel>
            <f:facet name="header">Consulta Cliente PF</f:facet>
           
            <s:decorate id="cpfField" template="/layout/edit.xhtml">
                <ui:define name="label">CPF</ui:define>
                <h:inputText id="cpfFieldId" value="#{ClientePFBean.cpf}" size="18" maxlength="14" >
					<rich:jQuery selector="#cpfFieldId" query="mask('999.999.999-99')" timing="onload"></rich:jQuery>
					<s:validate />
                </h:inputText>
            </s:decorate>
            
<!--             <s:decorate id="dataNascimentoField" template="layout/edit.xhtml">     
		         <ui:define name="label">Data de Nascimento</ui:define>    
	             <h:inputText id="dataNascimento" 
	                    value="#{ClientePFBean.dataNascimento}" size="11" >
	              <s:convertDateTime pattern="dd/MM/yyyy" type="date" />
                  <rich:jQuery selector="#dataNascimento" query="mask('99/99/9999')" timing="onload"></rich:jQuery>
	              </h:inputText>
			</s:decorate>            
 -->           
            <s:decorate id="nomeField" template="/layout/edit.xhtml">
                <ui:define name="label">Nome</ui:define>
                <h:inputText id="nomeFieldId" value="#{ClientePFBean.nome}" size="100">
                </h:inputText>
            </s:decorate>

            <div style="clear:both"/>



        </rich:panel>
                
	        <div class="actionButtons">
	            <a:commandButton id="btPesquisaCliente" value="Consultar"
	                    action="#{ClientePFBean.pesquisaCliente}"  reRender="painelResultado"/>
	        </div>
	        
	        
		    <rich:panel id="painelResultado">
		        <f:facet name="header">Listagem de Clientes</f:facet>
		
		        <div class="results">
		
		            <h:outputText value="Nenhum cliente listado"
		                      rendered="#{empty ClientePFBean.clientesPF}" />
							
						<rich:dataTable id="clientesPFSelecionadosList" value="#{ClientePFBean.clientesPF}"
							var="_clientesPFSelecionado" rendered="#{not empty ClientePFBean.clientesPF}" >

							<h:column>
								<f:facet name="header">Nome</f:facet>
		                    	#{_clientesPFSelecionado.nome}
							</h:column>
							
							<h:column styleClass="center-text">
								<f:facet name="header">CPF</f:facet>
		                    	#{_clientesPFSelecionado.cpf}
							</h:column>
														
							<h:column styleClass="center-text">
								<f:facet name="header">Data Nascimento</f:facet>
		                    	<h:outputFormat value="{0,date,dd/MM/yyyy}"  >
		                    		<f:param value="#{_clientesPFSelecionado.dataNascimento}" />
		                    	</h:outputFormat> 
							</h:column>

			                <h:column styleClass="center-text">
			                    <f:facet name="header">Acao</f:facet>
			                    <s:link id="editarCliente"
			                         value="Editar"
									action="#{ClientePFBean.editar}" 
									view="/clientePF.xhtml" 
									propagation="join" >
									<f:param name="idCliente" value="#{_clientesPFSelecionado.id}" />
								</s:link>
						                                
			                </h:column>
														
		            </rich:dataTable>
		
		        </div>

		    </rich:panel>
		    

    </h:form>

</ui:define>

</ui:composition>
